]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st/viewport: Set adjustment properties all at once
authorJulian Sparber <julian@sparber.net>
Tue, 21 Nov 2023 10:29:46 +0000 (11:29 +0100)
committerJulian Sparber <julian@sparber.net>
Tue, 21 Nov 2023 15:31:56 +0000 (16:31 +0100)
This ensures that that property changes are notified all at the same
time and only after all were set. If we notify too early handlers
may act on a "broken" viewport.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3023>

src/st/st-viewport.c

index f65c70c48c92892e976f9ed6fff3adbb90c5ed3e..fa16fdaadc8eecff6744f5d650fd013fbff5bdc9 100644 (file)
@@ -309,32 +309,30 @@ st_viewport_allocate (ClutterActor           *actor,
     {
       double prev_value;
 
-      g_object_set (G_OBJECT (priv->vadjustment),
-                    "lower", 0.0,
-                    "upper", MAX (min_height, avail_height),
-                    "page-size", avail_height,
-                    "step-increment", avail_height / 6,
-                    "page-increment", avail_height - avail_height / 6,
-                    NULL);
-
       prev_value = st_adjustment_get_value (priv->vadjustment);
-      st_adjustment_set_value (priv->vadjustment, prev_value);
+
+      st_adjustment_set_values (priv->vadjustment,
+                                prev_value,
+                                0.0,
+                                MAX (min_height, avail_height),
+                                avail_height / 6,
+                                avail_height - avail_height / 6,
+                                avail_height);
     }
 
   if (priv->hadjustment)
     {
       double prev_value;
 
-      g_object_set (G_OBJECT (priv->hadjustment),
-                    "lower", 0.0,
-                    "upper", MAX (min_width, avail_width),
-                    "page-size", avail_width,
-                    "step-increment", avail_width / 6,
-                    "page-increment", avail_width - avail_width / 6,
-                    NULL);
-
       prev_value = st_adjustment_get_value (priv->hadjustment);
-      st_adjustment_set_value (priv->hadjustment, prev_value);
+
+      st_adjustment_set_values (priv->hadjustment,
+                                prev_value,
+                                0.0,
+                                MAX (min_width, avail_width),
+                                avail_width / 6,
+                                avail_width - avail_width / 6,
+                                avail_width);
     }
 }